package com.xiaotu.service.sw.impl;

import cn.hutool.core.util.ObjectUtil;
import com.xiaotu.dao.sw.SwCommentInfoMapper;
import com.xiaotu.model.SwCommentInfoModel;
import com.xiaotu.service.sw.SwCommentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author zhangxiao
 * @create 2021-08-30 16:43
 */
@Service
@Transactional
public class SwCommentInfoServiceImpl implements SwCommentInfoService {

    @Autowired
    private SwCommentInfoMapper swCommentInfoMapper;

    @Override
    public void save(SwCommentInfoModel swCommentInfoModel) {
        if (ObjectUtil.isNull(swCommentInfoModel.getCommentId())) {
            swCommentInfoMapper.insert(swCommentInfoModel);
        } else {
            swCommentInfoMapper.updateByPrimaryKey(swCommentInfoModel);
        }
    }
}
